<?php
/**
 * Created by PhpStorm.
 * User: moon
 * Date: 2021/6/8
 * Time: 21:04
 */

namespace app\admin\model;

use app\BaseModel;

class Goods extends BaseModel
{
    protected $table = 'sh_goods';

    public $rule = [
        'name|商品名' => 'require',
        'subtitle|商品副标题' => 'require',
        'icon' => 'require',
        'item' => 'require|between:1,2',
        'isSpec' => 'require|between:1,2',
        'salesNum|销量' => 'number|>=:0',
        'price|价格' => 'require|float|>=:0',
        'wholesale_price|批发价格' => 'float|>=:0',
        'stock|库存' => 'number|>=:0',
        'sort|排序' => 'number|>=:0',
        'is_recommend' => 'require|between:1,2',
        'display' => 'require|between:1,2',
        'unit|商品单位id' => 'number|>=:0',
        'unit_weight|外送重量/数量' => 'float|>=:0',
        'status' => 'require|between:1,3',
        'min_num|起购数量' => 'number|>=:0',
        'max_num|限购数量' => 'number|>=:0',
        'deleted' => 'number|between:0,1'
    ];
    public $message = [
        'icon.require' => '商品封面图必须上传',
        'item.require' => '销售渠道必选',
        'item.between' => '销售渠道选择异常',
        'isSpec.require' => '规格必选',
        'isSpec.between' => '规格选择异常',
        'is_recommend.require' => '是否推荐必选',
        'is_recommend.between' => '是否推荐选择异常',
        'display.require' => '是否显示必选',
        'display.between' => '是否显示选择异常',
        'status.require' => '状态必选',
        'status.between' => '状态选择异常',
        'deleted.between' => '删除操作异常'
    ];
}
